package beerAgent;

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;



public class BeerPanelTest {
	public static void main(String[] args) throws InterruptedException {
		BeerGame game = new BeerGame(1,3);

		JFrame frame = new JFrame(); 
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JPanel panel = game.getGamePanel();
		panel.setSize(new Dimension(2000, 2000));
		frame.setContentPane(panel); 
		frame.setSize(1000, 1000); 
		frame.setVisible(true); 

		for(int j = 0; j<10;j++) {

			for (int i = 0; i < 50; i++) {
				doRandomMove(game); 
			}
			game.reset();
		}

	}

	private static void doRandomMove(BeerGame game) throws InterruptedException{
		double move = Math.random(); 
		int step = (int) (Math.random()*5);
		if (move < 0.25){
			game.move(BeerModel.Action.STAND_STILL,step);
		} else if (move < 0.75){
			game.move(BeerModel.Action.MOVE_LEFT,step);
		} else {
			game.move(BeerModel.Action.MOVE_RIGHT,step);
		}
		Thread.sleep(250);
	}
}
